package fichier;

public class Sortie extends Mouvement {
	
	protected Lieu destination;
	protected String numeroBon;
	private static final String table = "part";
	
	public Sortie(Modele modele, Lieu destination, String numeroBon, String date){
		super();
		this.modele = modele;
		this.destination = destination;
		this.numeroBon = numeroBon;
		this.dateMouvement = date;
		this.ajouter();
		
	}
	
	public Sortie(int idModele, String date){
		super();
		this.modele = new Modele(idModele);
		this.dateMouvement = date;
	}
	
	private void ajouter(){
		SelectData.REQUETE  = "INSERT INTO "+ table +" VALUES (null, "+this.modele.getID()+",'"+
														this.dateMouvement+"', '"+
														this.destination.getLibelle() +"', "+this.numeroBon+")";
		System.out.println(SelectData.REQUETE);
		SelectData.startUpdate();
	}
	
	public void supprimer(){
		SelectData.REQUETE = "DELETE FROM "+ table +" WHERE id_modele ="+this.modele.getID()+" and date_modele = '"+this.dateMouvement+"'";
		System.out.println(SelectData.REQUETE);
		SelectData.startUpdate();
	}
	
	
	
}














































